import moment from 'moment';

let dates = [];
let onlineData = [];
let offlineData = [];

const range = [64, 93];

for (let i = 0; i <= 7 * 24; i++) {
    const value = (Math.random() * (range[1] - range[0]) + range[0]).toFixed(0);
    dates.push(moment().subtract(7 * 24 - i, 'hour').format('YYYY-MM-DD HH:mm:SS'));
    onlineData.push((Math.random() * 50 + 50).toFixed(2));
    offlineData.push(value);
}

export const eventHandleOption = {
    color: ['#348EED', '#FBDF90'],
    title: {
        text: '报障处理'
    },
    legend: {
        show: true,
    },
    tooltip: {
        trigger: 'axis'
    },
    toolbox: {
        feature: {
            saveAsImage: { name: 'DHCP', title: '保存' }
        }
    },
    xAxis: {
        data: dates
    },
    yAxis: [
        {
            name: '处理数量',
            max: 100,
            type: 'value',
        },
        {
            name: '处理率',
            type: 'value',
            max: 100,
        },
    ],
    dataZoom: [
        {
            show: true,
            realtime: true,
            start: 0,
            end: 100
        }
    ],
    series: [
        {
            name: '处理数量',
            data: offlineData,
            type: 'bar'
        },
        {
            name: '处理率',
            yAxisIndex: 1,
            data: onlineData,
            type: 'line'
        }
    ],
    animationDuration: 1000
};
